require(['./config'], () => {
    require(['template', 'url','swiper','header', 'bootstrap','footer','float-box'], ( template, url,Swiper,bootstrap) => {
        class List {
            constructor () {
                this.banner()
                this.list()
            }
            banner(){
                new Swiper ('.lunbo', {
                    loop: true, // 循环模式选项
                    autoplay:true,
                    // 如果需要分页器
                    pagination: {
                      el: '.banner-pagination',
                    },
                    
                    // 如果需要前进后退按钮
                    navigation: {
                      nextEl: '.swiper-button-next',
                      prevEl: '.swiper-button-prev',
                    }
                })      
            }
            list () {
                $.get(url.rap2 + '/api/index/list', resp => {
                    console.log(resp)
                    if (resp.code === 200) {
                        const { list } = resp.body
                        $('#goodsList').html(template('goodsTemplate', { list }))
                    }
                })
            }
        }
        new List()
    })
})